/*
 * @Author: szx
 * @Date: 2022-05-25 14:55:11
 * @LastEditTime: 2022-05-25 15:05:24
 * @Description:
 * @FilePath: \leetcode\面试题\10\02\02.js
 */
/**
 * @param {string[]} strs
 * @return {string[][]}
 */
var groupAnagrams = function (strs) {
    const map = new Object();
    for (let s of strs) {
        const count = new Array(26).fill(0);
        for (let c of s) {
            count[c.charCodeAt() - 'a'.charCodeAt()]++;
        }
        map[count] ? map[count].push(s) : (map[count] = [s]);
    }
    return Object.values(map);
};
